#include <stdio.h>
#include <string.h>

int shu[10003];
int n,k;
int tot;
main()
{
	
	int i,j,sang;
	while(1)
	{
		scanf("%d%d", &n, &k);
		if (n==-1 && k==-1) break;
		memset(shu,0,sizeof(shu));
	//	memset(out,0,sizeof(out));
		for (i=0;i<=n;i++)
			scanf("%d", &shu[i]);
		
		for (i=n;i>=k;i--)
		{			
			sang=shu[i];
			shu[i-k]-=sang;
			shu[i]=0;
		}
	
		tot=0;
		for (i=0;i<k;i++) tot+=shu[i];
		if (tot==0) printf("0\n");
		else
		{
			tot=k;
			while (shu[tot]==0) tot--;
			for (i=0;i<tot;i++)
				printf("%d ", shu[i]);
			printf("%d\n",shu[i]);
		}
	}


	return 0;
}